Object
and Counter Design
A performance
object is an entity for which performance data is available. Performance
counters define the type of data that is available for a counter object. An
application can provide information for multiple performance objects, each with
one or more counters.
An
application can also define objects that have multiple instances. For example,
a SCSI application could use a single set of counter definitions to define a
drive object with two counters, such as Bytes Read and Bytes Written. The
performance DLL for the application could report performance data for each
drive controlled by the application.
The Windows
NT Performance Monitor can show some counters as rates, such as Page
Faults/sec, as well as a raw count. This gives context to the users, so they do
not have to compare data from different time intervals. However, you do not
have to take this into account when you design a counter. You increment the
counter and let the monitor application do the work of converting raw counts to
a rate.
The method you
use to collect the data can be as simple as incrementing a counter each time a
particular routine in the application is called, or it can involve time-consuming
calculations. Counters and timers should increment and never be cleared.
Counters can wrap, as long as they do not wrap twice between snapshots. Your
application can collect and store data during its normal execution, as long as
it does not affect the its performance.
For some
types of data, it may be more efficient or appropriate to collect the data on
demand. In this situation, the performance DLL must communicate to the
application that the data has been requested. For data that is expensive to
collect (in terms of processor time or memory usage), consider collecting data
only when the performance monitoring program requests Costly data. This
allows a custom performance monitoring program to routinely request data for
all counters that are not costly. The data can be requested only when needed.
The Windows NT Performance Monitor does not collect Costly data.